<template>
	<view class="content">
		<view class="title1">充值数量：</view>
		<view class="box1">
			<input type="number" v-model="amount"  placeholder="请输入你要充值的数量"/>
		</view>
		<!-- <view class="title1">上传充币凭证：</view>
		<view class="box2" >
			<uni-file-picker 
			    v-model="imageValue" 
			    fileMediatype="image" 
				:image-styles="imageStyles"
			    mode="grid" 
				ref="files" :auto-upload="false"
			    @select="select" 
				:limit="1"
			></uni-file-picker>
		</view> -->
		<view class="mybtn" @click="make">
			提交申请
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				imageValue:[],
				imageStyles:{
				                 width:365,
				                 height:210,
				                 border:false
				             },
				coin_type:'',
				amount:'',
				img:''
			}
		},
		onShow() {
			this.amount=''
			// this.img=''
			// this.imageValue=[]
		},
		methods: {
			make(){
				
				uni.getStorage({
					key:'token',
					success:(res)=>{
						this.token = res.data
						this.http({
							url:'/api/User/filChargeApply',
							method:'POST',
							header:{
								"content-type": "application/x-www-form-urlencoded",
								token:this.token
							},
							data:{
								amount:this.amount,
								// img:this.img
							},
							success:(res)=>{
								uni.showToast({
									title:res.msg,
									icon:'none'
								})
								setTimeout(()=>{
									uni.navigateTo({
										url:'../filjilu?currentIndex=0'
									})
								},500)
							}
						})
					}
				})
			},
			// 获取上传状态
			select(e){
			    console.log('选择文件：',e)
				const tempFilePaths = e.tempFilePaths;
				console.log(tempFilePaths[0])
					setTimeout(()=>{
						uni.uploadFile({
							url:this.$base_url+ '/api/Upload/upload', 
							filePath:tempFilePaths[0],
							name: 'file',
							success:(res)=>{
								var d =res.data
								var data=JSON.parse(d)
								console.log(data)
								this.img=data.url
								console.log(this.img)
								console.log("111111111111111111111")
							}
						})	
					},1000)
			},
		}
	}
</script>

<style lang="scss">
	
.content{
	width:750rpx;
	font-family: PingFang SC;
	.title1{
		margin: 30rpx 20rpx;
		height: 30rpx;
		font-size: 32rpx;
		font-weight: bold;
		color: #2b2b2b;
	}
	.box1{
		width: 710rpx;
		height: 60rpx;
		border: 1px solid #cccccc;
		border-radius: 15rpx;
		margin:0 auto;
		input{
			padding-left: 20rpx;
			padding-top: 5rpx;
			color: #2b2b2b;
		}
	}
	.box2{
		width: 710rpx;
		height: 400rpx;
		margin: 40rpx auto;
		border: 1px solid #cccccc;
		border-radius: 15rpx;
		
	}
	.mybtn{
		width: 710rpx;
		height: 80rpx;
		margin: 50rpx auto;
		background:#0072FF;	
		border-radius: 15rpx;
		font-size: 36rpx;
		font-weight: bold;
		color: #FFFFFF;
		text-align: center;
		line-height: 80rpx;
	}
}
</style>
